/*
 * RatingAndReview.java
 * 
 * Copyright 2012 Xinli Jia
 * 
 * Rating and review from Amazon data model
 */

package ie.dit.comp.lukejia.fyp.model;

import java.util.ArrayList;
import java.util.List;

public class RatingAndReview {
	private List<String> reviews = new ArrayList<String>();
	private int[] ratings = new int[5];
	private List<AbstractOfReview> abstracts = new ArrayList<AbstractOfReview>();

	public List<String> getReviews() {
		return reviews;
	}

	public void setReviews(List<String> reviews) {
		this.reviews = reviews;
	}

	public int[] getRatings() {
		return ratings;
	}

	public void setRatings(int[] ratings) {
		this.ratings = ratings;
	}

	public List<AbstractOfReview> getAbstracts() {
		return abstracts;
	}

	public void setAbstracts(List<AbstractOfReview> abstracts) {
		this.abstracts = abstracts;
	}

	public AbstractOfReview getFavorableReview() {
		AbstractOfReview r = null;
		for (AbstractOfReview a : abstracts) {
			if (a.getScore() > 3) {
				r = a;
				break;
			}
		}
		if (r != null)
			abstracts.remove(r);
		return r;
	}
	
	public AbstractOfReview getCriticalReview() {
		AbstractOfReview r = null;
		for (AbstractOfReview a : abstracts) {
			if (a.getScore() < 3) {
				r = a;
				break;
			}
		}
		if (r != null)
			abstracts.remove(r);
		return r;
	}

}
